using MediatR;
using B.S.XZYData.ErrorCode;

namespace B.S.XZYData.Api.Read.Application.Command.WorkTask
{
    /// <summary>
    /// 查询任务命令
    /// </summary>
    public class QueryWorkTaskCommand : IRequest<ApiResult<WorkTaskPageResult>>
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 30;

        /// <summary>
        /// 工单编号
        /// </summary>
        public string? WorkOrderNumber { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string? ProcessName { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string? ProcessNumber { get; set; }

        /// <summary>
        /// 不良品项列表
        /// </summary>
        public string? DefectiveItemList { get; set; }

        /// <summary>
        /// 计划开始时间开始
        /// </summary>
        public DateTime? PlannedStartTimeStart { get; set; }

        /// <summary>
        /// 计划开始时间结束
        /// </summary>
        public DateTime? PlannedStartTimeEnd { get; set; }

        /// <summary>
        /// 计划结束时间开始
        /// </summary>
        public DateTime? PlannedEndTimeStart { get; set; }

        /// <summary>
        /// 计划结束时间结束
        /// </summary>
        public DateTime? PlannedEndTimeEnd { get; set; }

        /// <summary>
        /// 计划数最小值
        /// </summary>
        public int? PlannedQuantityMin { get; set; }

        /// <summary>
        /// 计划数最大值
        /// </summary>
        public int? PlannedQuantityMax { get; set; }

        /// <summary>
        /// 良品数最小值
        /// </summary>
        public int? GoodQuantityMin { get; set; }

        /// <summary>
        /// 良品数最大值
        /// </summary>
        public int? GoodQuantityMax { get; set; }

        /// <summary>
        /// 不良品数最小值
        /// </summary>
        public int? DefectiveQuantityMin { get; set; }

        /// <summary>
        /// 不良品数最大值
        /// </summary>
        public int? DefectiveQuantityMax { get; set; }

        /// <summary>
        /// 实际开始时间开始
        /// </summary>
        public DateTime? ActualStartTimeStart { get; set; }

        /// <summary>
        /// 实际开始时间结束
        /// </summary>
        public DateTime? ActualStartTimeEnd { get; set; }

        /// <summary>
        /// 实际结束时间开始
        /// </summary>
        public DateTime? ActualEndTimeStart { get; set; }

        /// <summary>
        /// 实际结束时间结束
        /// </summary>
        public DateTime? ActualEndTimeEnd { get; set; }

        /// <summary>
        /// 创建时间开始
        /// </summary>
        public DateTime? CreationTimeStart { get; set; }

        /// <summary>
        /// 创建时间结束
        /// </summary>
        public DateTime? CreationTimeEnd { get; set; }

        /// <summary>
        /// 排序字段
        /// </summary>
        public string SortField { get; set; } = "Id";

        /// <summary>
        /// 排序方向
        /// </summary>
        public string SortDirection { get; set; } = "desc";
    }

    /// <summary>
    /// 任务分页结果
    /// </summary>
    public class WorkTaskPageResult
    {
        /// <summary>
        /// 任务列表
        /// </summary>
        public List<WorkTaskDto> Data { get; set; } = new List<WorkTaskDto>();

        /// <summary>
        /// 总数
        /// </summary>
        public int Total { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }
    }

    /// <summary>
    /// 任务DTO
    /// </summary>
    public class WorkTaskDto
    {
        /// <summary>
        /// 任务ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 工序ID
        /// </summary>
        public long ProcessId { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string? ProcessName { get; set; }

        /// <summary>
        /// 工序编号
        /// </summary>
        public string? ProcessNumber { get; set; }

        /// <summary>
        /// 报工权限
        /// </summary>
        public string? ReportingPermissions { get; set; }

        /// <summary>
        /// 报工数配比
        /// </summary>
        public int? ReportingRatio { get; set; }

        /// <summary>
        /// 不良品项列表
        /// </summary>
        public string? DefectiveItemList { get; set; }

        /// <summary>
        /// 分配列表
        /// </summary>
        public string? AllocationList { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? PlannedStartTime { get; set; }

        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime? PlannedEndTime { get; set; }

        /// <summary>
        /// 计划数
        /// </summary>
        public int? PlannedQuantity { get; set; }

        /// <summary>
        /// 良品数
        /// </summary>
        public int? GoodQuantity { get; set; }

        /// <summary>
        /// 不良品数
        /// </summary>
        public int? DefectiveQuantity { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatorDate { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? Creator { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string? Updator { get; set; }
    }
} 